#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<fcntl.h>


int main()
{  
    umask(0);
    if ( mkfifo("name_pipe_file", 0644) == -1) perror("create name_pipe fail"), exit(0);

    int fd = open("name_pipe_file", O_RDWR | O_APPEND);
    if (fd < 0) perror("open name_pipe_file fail"), exit(0);
    
    //send message to process B
    while(true)
    {
        char buff[1024] = "hey ,this's process A, can you receive me?";
        int n = write(fd, buff, sizeof(buff));
        if(n < 0) perror("write fail"), exit(0);
        sleep(1);
    }

    return 0;
}
